#include "settings.h"
#include "ui_settings.h"

Settings::Settings(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::Settings)
{
    ui->setupUi(this);
    resX = 800;
    resY = 600;
    hard = cheat = false;
    this->ui->EasyRB->setChecked(true);

    this->setFixedSize(800,600);


    this->ui->background->setGeometry(0,0,800,600);
    QPixmap *bkground = new QPixmap("Images\\Instructions.png");
    this->ui->background->setPixmap(*bkground);
    this->ui->background->show();
}

Settings::~Settings()
{
    delete ui;
}

void Settings::on_EasyRB_clicked()
{
    hard = false;
}

void Settings::on_hardRB_clicked()
{
    hard = true;
}

void Settings::on_doneBtn_clicked()
{
    MainMenu *m = dynamic_cast<MainMenu*>(this->parent());
    m->resX = this->resX;
    m->resY = this->resY;
    m->hard = this->hard;
    m->cheat = this->cheat;
    m->show();
    this->deleteLater();
}

void Settings::on_resBox_currentIndexChanged(int index)
{
    if(index == 0){
        resX = 800;
        resY = 600;
    }else if(index == 1){
        resX = 1024;
        resY = 768;
    }else if(index == 2){
        resX = 1280;
        resY = 1024;
    }else{
        resX = 1680;
        resY = 1050;
    }
}

void Settings::on_cheatBox_clicked(bool checked)
{
    cheat = checked;
}
